package gatperdut.chato.core.interpreter.actions;

import gatperdut.chato.constants.CSConstantsCommandResult.CommandExecutionResult;
import gatperdut.chato.constants.CSConstantsString;
import gatperdut.chato.core.characters.BaseController;
import gatperdut.chato.core.interpreter.actions.generic.Action;
import gatperdut.chato.core.interpreter.grammar.comminfo.ScoreInfo;

public class ScoreAction extends Action {

    public ScoreAction( ScoreInfo info, BaseController entityController ) {
        super( info, entityController );
    }

    @Override
    public CommandExecutionResult perform() {
        checkForRunningCraft();

        StringBuilder sb = new StringBuilder( "" );

        sb.append( getEntityController().getCharacter().getName() + ", " + getEntityController().getCharacter().getShortDesc() + CSConstantsString.NEWLINE );
        sb.append( getEntityController().getScoresController().listScores() + CSConstantsString.NEWLINE );
        sb.append( getEntityController().getInventoryController().computeWeight() + " grams carried." );

        getEntityController().tx( sb.toString() );

        return CommandExecutionResult.OK;
    }

    @Override
    public boolean interruptsCrafting() {
        return false;
    }

    @Override
    public ScoreInfo getInfo() {
        return (ScoreInfo) super.getInfo();
    }
}
